﻿using System;
using Z16.BLI;

namespace Z16.SITE
{
    public partial class Calculadora : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["CodPerfil"] == null) || (Session["CodUsr"] == null))
            {
                Response.Write("<script>window.location=\'Login.aspx';</script>");
                return;
            }
        }

        protected void btnCalcular_Click(object sender, EventArgs e)
        {
            int[,] lista = new int[65, 13];

            lista[1, 1] = (txt011.Text == "" ? 0 : int.Parse(txt011.Text));
            lista[1, 2] = (txt012.Text == "" ? 0 : int.Parse(txt012.Text));
            lista[1, 3] = (txt013.Text == "" ? 0 : int.Parse(txt013.Text));
            lista[1, 4] = (txt014.Text == "" ? 0 : int.Parse(txt014.Text));
            lista[1, 5] = (txt015.Text == "" ? 0 : int.Parse(txt015.Text));

            lista[2, 1] = (txt021.Text == "" ? 0 : int.Parse(txt021.Text));
            lista[2, 2] = (txt022.Text == "" ? 0 : int.Parse(txt022.Text));
            lista[2, 3] = (txt023.Text == "" ? 0 : int.Parse(txt023.Text));
            lista[2, 4] = (txt024.Text == "" ? 0 : int.Parse(txt024.Text));
            lista[2, 5] = (txt025.Text == "" ? 0 : int.Parse(txt025.Text));

            lista[3, 1] = (txt031.Text == "" ? 0 : int.Parse(txt031.Text));
            lista[3, 2] = (txt032.Text == "" ? 0 : int.Parse(txt032.Text));
            lista[3, 3] = (txt033.Text == "" ? 0 : int.Parse(txt033.Text));
            lista[3, 4] = (txt034.Text == "" ? 0 : int.Parse(txt034.Text));
            lista[3, 5] = (txt035.Text == "" ? 0 : int.Parse(txt035.Text));

            lista[4, 1] = (txt041.Text == "" ? 0 : int.Parse(txt041.Text));
            lista[4, 2] = (txt042.Text == "" ? 0 : int.Parse(txt042.Text));
            lista[4, 3] = (txt043.Text == "" ? 0 : int.Parse(txt043.Text));
            lista[4, 4] = (txt044.Text == "" ? 0 : int.Parse(txt044.Text));
            lista[4, 5] = (txt045.Text == "" ? 0 : int.Parse(txt045.Text));

            lista[5, 1] = (txt051.Text == "" ? 0 : int.Parse(txt051.Text));
            lista[5, 2] = (txt052.Text == "" ? 0 : int.Parse(txt052.Text));
            lista[5, 3] = (txt053.Text == "" ? 0 : int.Parse(txt053.Text));
            lista[5, 4] = (txt054.Text == "" ? 0 : int.Parse(txt054.Text));
            lista[5, 5] = (txt055.Text == "" ? 0 : int.Parse(txt055.Text));

            lista[6, 1] = (txt061.Text == "" ? 0 : int.Parse(txt061.Text));
            lista[6, 2] = (txt062.Text == "" ? 0 : int.Parse(txt062.Text));
            lista[6, 3] = (txt063.Text == "" ? 0 : int.Parse(txt063.Text));
            lista[6, 4] = (txt064.Text == "" ? 0 : int.Parse(txt064.Text));
            lista[6, 5] = (txt065.Text == "" ? 0 : int.Parse(txt065.Text));

            lista[7, 1] = (txt071.Text == "" ? 0 : int.Parse(txt071.Text));
            lista[7, 2] = (txt072.Text == "" ? 0 : int.Parse(txt072.Text));
            lista[7, 3] = (txt073.Text == "" ? 0 : int.Parse(txt073.Text));
            lista[7, 4] = (txt074.Text == "" ? 0 : int.Parse(txt074.Text));
            lista[7, 5] = (txt075.Text == "" ? 0 : int.Parse(txt075.Text));

            lista[8, 1] = (txt081.Text == "" ? 0 : int.Parse(txt081.Text));
            lista[8, 2] = (txt082.Text == "" ? 0 : int.Parse(txt082.Text));
            lista[8, 3] = (txt083.Text == "" ? 0 : int.Parse(txt083.Text));
            lista[8, 4] = (txt084.Text == "" ? 0 : int.Parse(txt084.Text));
            lista[8, 5] = (txt085.Text == "" ? 0 : int.Parse(txt085.Text));


            lista[9, 1] = (txt091.Text == "" ? 0 : int.Parse(txt091.Text));
            lista[9, 2] = (txt092.Text == "" ? 0 : int.Parse(txt092.Text));
            lista[9, 3] = (txt093.Text == "" ? 0 : int.Parse(txt093.Text));
            lista[9, 4] = (txt094.Text == "" ? 0 : int.Parse(txt094.Text));
            lista[9, 5] = (txt095.Text == "" ? 0 : int.Parse(txt095.Text));

            lista[10, 1] = (txt101.Text == "" ? 0 : int.Parse(txt101.Text));
            lista[10, 2] = (txt102.Text == "" ? 0 : int.Parse(txt102.Text));
            lista[10, 3] = (txt103.Text == "" ? 0 : int.Parse(txt103.Text));
            lista[10, 4] = (txt104.Text == "" ? 0 : int.Parse(txt104.Text));
            lista[10, 5] = (txt105.Text == "" ? 0 : int.Parse(txt105.Text));

            lista[11, 1] = (txt111.Text == "" ? 0 : int.Parse(txt111.Text));
            lista[11, 2] = (txt112.Text == "" ? 0 : int.Parse(txt112.Text));
            lista[11, 3] = (txt113.Text == "" ? 0 : int.Parse(txt113.Text));
            lista[11, 4] = (txt114.Text == "" ? 0 : int.Parse(txt114.Text));
            lista[11, 5] = (txt115.Text == "" ? 0 : int.Parse(txt115.Text));

            lista[12, 1] = (txt121.Text == "" ? 0 : int.Parse(txt121.Text));
            lista[12, 2] = (txt122.Text == "" ? 0 : int.Parse(txt122.Text));
            lista[12, 3] = (txt123.Text == "" ? 0 : int.Parse(txt123.Text));
            lista[12, 4] = (txt124.Text == "" ? 0 : int.Parse(txt124.Text));
            lista[12, 5] = (txt125.Text == "" ? 0 : int.Parse(txt125.Text));

            lista[13, 1] = (txt131.Text == "" ? 0 : int.Parse(txt131.Text));
            lista[13, 2] = (txt132.Text == "" ? 0 : int.Parse(txt132.Text));
            lista[13, 3] = (txt133.Text == "" ? 0 : int.Parse(txt133.Text));
            lista[13, 4] = (txt134.Text == "" ? 0 : int.Parse(txt134.Text));
            lista[13, 5] = (txt135.Text == "" ? 0 : int.Parse(txt135.Text));

            lista[13, 1] = (txt141.Text == "" ? 0 : int.Parse(txt141.Text));
            lista[13, 2] = (txt142.Text == "" ? 0 : int.Parse(txt142.Text));
            lista[13, 3] = (txt143.Text == "" ? 0 : int.Parse(txt143.Text));
            lista[13, 4] = (txt144.Text == "" ? 0 : int.Parse(txt144.Text));
            lista[13, 5] = (txt145.Text == "" ? 0 : int.Parse(txt145.Text));


            lista[13, 1] = (txt151.Text == "" ? 0 : int.Parse(txt151.Text));
            lista[13, 2] = (txt152.Text == "" ? 0 : int.Parse(txt152.Text));
            lista[13, 3] = (txt153.Text == "" ? 0 : int.Parse(txt153.Text));
            lista[13, 4] = (txt154.Text == "" ? 0 : int.Parse(txt154.Text));
            lista[13, 5] = (txt155.Text == "" ? 0 : int.Parse(txt155.Text));


            Atividade ati = new Atividade();
            txtTotal.Text = ati.CalcularComplexidade(lista).ToString();
        }
    }
}